package com.wang.springbootinit.controller;

import com.wang.springbootinit.common.BaseResponse;
import com.wang.springbootinit.common.ResultUtils;
import com.wang.springbootinit.model.entity.Grade;
import com.wang.springbootinit.service.GradeService;
import com.wang.springbootinit.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/grade")
public class GradeController {
    @Autowired
    private GradeService gradeService;

    @GetMapping("/getCurrentStudentGrade")
    public BaseResponse<List<Grade>> getCurrentStudentGrade(HttpServletRequest request) {
        return ResultUtils.success(gradeService.getCurrentStudentGrade(request));
    }

    @GetMapping("/getOptions")
    public BaseResponse<Map<String, List<String>>> getSemesterOptions(HttpServletRequest request) {
        return ResultUtils.success(gradeService.getOptionsByCurrentUser(request));
    }
}
